package center

import (
	"emma/uuid"
	. "login_server/logic/internal"
	"proto/server/center"
	"proto/server/login"
)

type centerService struct {
}

func init() {
	service := new(centerService)
	Protocol.Register(new(proto_server_login.Login), service.login)
	Protocol.Register(new(proto_server_center.OnRegister), service.onRegister)
}

func (*centerService) login(args []interface{}) {
	request := args[0].(*proto_server_login.Login)

	account := []byte(request.Account)
	response := new(proto_server_login.OnLogin)
	response.GateId = request.GateId
	response.ClientId = request.ClientId
	response.PlayerId = uuid.GenerateFixed(account).String()

	rpc.OnLogin(response)
}

func (*centerService) onRegister(args []interface{}) {
	response := args[0].(*proto_server_center.OnRegister)
	_ = response
}
